/* Ticket.h
 * Author: mtreece
 * Date Started: 02/09/2010
 * Purpose:
 *  Header file for Ticket.cpp
 */
#ifndef TICKET_H
#define TICKET_H

#include "TicketLine.h"

#define TICKET_SEPARATOR "================================="

class Ticket{
	private:
		/* TicketLine data; 
		 * refactor later...
		 */
		TicketLine **lines;

		/* Serial number of this
		 * Ticket object...
		 */
		unsigned int serial;

		/* Static variable which
		 * holds the next serial
		 * number
		 */
		static unsigned int nextSerial;

		/* Index number of the next
		 * slot to place a TicketLine.
		 */
		short nextSlot;

		/* Capacity of our ticket...
		 * (Just how many TicketLines
		 *  were we to keep track of??)
		 */
		int capacity;

	public:
		/* Specify n Tiketlines.
		 */
		Ticket(unsigned int);

		/* Ticket deconstructor...
		 */
		~Ticket();

		/* Get total worth of this 
		 * ticket... includes the
		 * the possibility of a 
		 * Jackpot Winner.
		 *
		 * The winning TicketLine is
		 * passed as 1st parameter.
		 */
		MoneyWorth* getWorth(TicketLine*);

		/* Allow for a build-up method
		 * to add TicketLine objects
		 * to a Ticket.
		 * 
		 * TODO: Handle exceptions?
		 *       Keep 'n' consistent?
		 *       Or just ignore?
		 */
		void addTicketLine(TicketLine*);

		/* Add a single random TicketLine to
		 * the collection of lines
		 */
		void addRandomTicketLine();

		/* Add all random TicketLines
		 * to the collection...
		 * (will remove all previously
		 *  stored ticketlines, if any)
		 */
		void addAllRandom();

		/* Call the toString() method
		 * off of all stored TicketLines
		 * in this Ticket, and printing
		 * accordingly
		 */
		void printTicket();

		/* Retrieve a TicketLine object
		 * from the Ticket...
		 * The integer input is an index
		 * into the Ticket collection.
		 */
		TicketLine* getTicket(int);

		/* Returns the number of TicketLine
		 * objects held by this Ticket...
		 * (or more precisely, the capacity)
		 */
		int size();
};

#endif
